var jsonFile = require('jsonfile')
var fileName = 'xinghan.json'
const axios = require('axios')
var jsonData = jsonFile.readFileSync(fileName)
const qs = require('qs')

const phone = jsonData.phone
const pwd = jsonData.pwd
const token = jsonData.token
const Xtoken = jsonData.Xtoken
const pay_pwd = jsonData.pay_pwd
const goods = jsonData.goods
var requestArray = []

const instance = axios.create({
  credentials: true,
  baseURL: 'https://www.xhan.art',
  // headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36' }
})
instance.defaults.headers['Content-Type'] = 'application/json'
instance.defaults.headers['Authorization'] = token

const Xinstance = axios.create({
  credentials: true,
  baseURL: 'https://www.xhan.art',
  // headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36' }
})
Xinstance.defaults.headers['Content-Type'] = 'application/json'
Xinstance.defaults.headers['Authorization'] = Xtoken






pushList()


// 商品列表填充
function pushList() {
  setInterval(() => {
    for (let item in goods) {
      Xinstance.post('/api/api/collectionOrder/shoppingPay2?orderCode=202304101347063752204824063243&payPassword=&payType=4').then(res => {
        console.log(res.data.data.message)

      }).catch(err => {
        console.log(err)
      })
    }
  }, 400)
}